/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo09_赋值运算符 {

    public static void main(String[] args) {

        // 定义变量    
        int i = 3; // 将3赋值给变量i    
        i = i + 2; // 将变量i和2相加,再赋值给变量i    
        System.out.println(i);
        // +=: 赋值运算符, 将=左边的变量和=右边的值进行操作,再赋值给变量    
        int j = 10;
        j += 5; // j = j + 5    
        System.out.println(j);

        int m = 10;
        m -= 5; // m = m ‐ 5;    
        System.out.println(m);
        System.out.println("‐‐‐‐‐‐‐‐‐‐");
        byte b = 1;
        // b = b + 2; // 错误: 不兼容的类型: 从int转换到byte可能会有损失    
        // b += 2; // 可以

        b = (byte) (b + 2);
        System.out.println(b);


        int  k =10;

        k*=10;       // k = k*10;


        System.out.println(k);



    }
}
